Ajax Type Ahead
https://rmaruon.github.io/javascript30/06/
Fetch API
Responseにはjsonメソッドがある
スプレッド構文
JSONを取得して、配列に格納する
code:js
const endpoint = "
https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763cdddd704f8ffd3ea9a3e81d25e2c6f6/cities.json";
let cities = [];
fetch(endpoint)
.then((blob) => blob.json())
.then((data) => cities.push(...data));
正規表現のパターンに変数を用いる
数値をカンマ区切りにする